home *** CD-ROM | disk | FTP | other *** search
- //---------------------------------------------------------------------------
- //Borland C++Builder
- //Copyright (c) 1987, 1998 Borland International Inc. All Rights Reserved.
- //---------------------------------------------------------------------------
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #include <assert.h>
- #include <math.h>
- #include <registry.hpp>
- #pragma hdrstop
-
- #include "reblddlg.h"
- #include "NewBrow.h"
- #include "about.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.dfm"
- TMainForm *MainForm;
- //---------------------------------------------------------------------------
- __fastcall TMainForm::TMainForm(TComponent* Owner)
- : TForm(Owner)
- {
- Application->OnHint = ShowHint;
- }
- //---------------------------------------------------------------------------
- void __fastcall TMainForm::ShowHint(TObject *Sender)
- {
- StatusBar->SimpleText = Application->Hint;
- }
-
- void __fastcall TMainForm::FormCreate(TObject *Sender)
- {
- // Initialize Database
- GetRegInfo();
- WriteRegKeys();
- ClassOrgDB->Params->Values["Path"] = LocalTablesDir;
-
- // Open Tables
- try {
- VCLTable->Open();
- }
- catch (EDatabaseError& E) {
- ShowMessage(E.Message + "Recopy vcltable.* files from cd!");
- return;
- }
-
- Application->Title = "VCL Object Browser";
- Application->Icon->LoadFromFile(LocalTablesDir + "Browser.ico");
- DestTable->Open();
- ClassListTab->Open();
- RawVCLTable = new TCloneTable(VCLTable, True);
- RawVCLTable->Open();
-
- // Initialize Variables
- MemberSearch = false;
- InitializedTable = false;
- MembPgCtl->MultiLine = true;
- MembersLV->Parent = MembPgCtl;
- MembersLV->Align = alBottom;
- ParsingHeaders = false;
- DeleteTabs = false;
- IsOperator = false;
- }
- //------------------------------------------------------------
- void __fastcall TMainForm::FormShow(TObject *Sender)
- {
- // Setup registry stuff
- TRegistry *MyRegistry = new TRegistry();
- String Key;
- String Key2;
- String Key3;
- const String Temp = "\\software\\borland\\VCL Object Browser\\";
- Key = Temp + "colors";
- Key2 = Temp + "fonts";
- Key3 = Temp + "fonts\\size";
-
- // Load background colors from registry
- try {
- MyRegistry->RootKey = HKEY_LOCAL_MACHINE;
- assert(MyRegistry->OpenKey(Key, false));
- DeclareRE->Color = static_cast<TColor>
- (StrToInt(MyRegistry->ReadString("Declaration")));
- DefineRE->Color = static_cast<TColor>
- (StrToInt(MyRegistry->ReadString("Definition")));
- ClassLB->Color = static_cast<TColor>
- (StrToInt(MyRegistry->ReadString("QuickClass")));
- MembersLV->Color = static_cast<TColor>
- (StrToInt(MyRegistry->ReadString("MemberList")));
- Grid->Color = static_cast<TColor>
- (StrToInt(MyRegistry->ReadString("Grid")));
- hppFileRE->Color = static_cast<TColor>
- (StrToInt(MyRegistry->ReadString("HeaderPage")));
- pasFileRE->Color = static_cast<TColor>
- (StrToInt(MyRegistry->ReadString("DefinitionPage")));
-
- // Load fonts from registry
- MyRegistry->RootKey = HKEY_LOCAL_MACHINE;
- assert(MyRegistry->OpenKey(Key2, false));
- DeclareRE->Font->Color = static_cast<TColor>
- (StrToInt(MyRegistry->ReadString("Declaration")));
- DefineRE->Font->Color = static_cast<TColor>
- (StrToInt(MyRegistry->ReadString("Definition")));
- ClassLB->Font->Color = static_cast<TColor>
- (StrToInt(MyRegistry->ReadString("QuickClass")));
- MembersLV->Font->Color = static_cast<TColor>
- (StrToInt(MyRegistry->ReadString("MemberList")));
- hppFileRE->Font->Color = static_cast<TColor>
- (StrToInt(MyRegistry->ReadString("HeaderPage")));
- pasFileRE->Font->Color = static_cast<TColor>
- (StrToInt(MyRegistry->ReadString("DefinitionPage")));
- Grid->Columns->Items[1]->Font->Color = static_cast<TColor>
- (StrToInt(MyRegistry->ReadString("Grid")));
- Grid->Columns->Items[2]->Font->Color = static_cast<TColor>
- (StrToInt(MyRegistry->ReadString("Grid")));
- Grid->Columns->Items[3]->Font->Color = static_cast<TColor>
- (StrToInt(MyRegistry->ReadString("Grid")));
- Grid->Columns->Items[4]->Font->Color = static_cast<TColor>
- (StrToInt(MyRegistry->ReadString("Grid")));
-
- // Load font size
- MyRegistry->RootKey = HKEY_LOCAL_MACHINE;
- assert(MyRegistry->OpenKey(Key3, false));
- DeclareRE->Font->Size = StrToInt(MyRegistry->
- ReadString("Declaration"));
- DefineRE->Font->Size = StrToInt(MyRegistry->
- ReadString("Definition"));
- ClassLB->Font->Size = StrToInt(MyRegistry->
- ReadString("QuickClass"));
- MembersLV->Font->Size = StrToInt(MyRegistry->
- ReadString("MemberList"));
- hppFileRE->Font->Size = StrToInt(MyRegistry->
- ReadString("HeaderPage"));
- pasFileRE->Font->Size = StrToInt(MyRegistry->
- ReadString("DefinitionPage"));
- Grid->Columns->Items[1]->Font->Size = StrToInt(MyRegistry->
- ReadString("Grid"));
- Grid->Columns->Items[2]->Font->Size = StrToInt(MyRegistry->
- ReadString("Grid"));
- Grid->Columns->Items[3]->Font->Size = StrToInt(MyRegistry->
- ReadString("Grid"));
- Grid->Columns->Items[4]->Font->Size = StrToInt(MyRegistry->
- ReadString("Grid"));
- TFontStyles FStyle;
- ClassLB->Font->Style = FStyle;
- }
- catch(ERegistryException &E) {
- ShowMessage(E.Message);
- delete MyRegistry;
- return;
- }
- delete MyRegistry;
- ClassLB->SetFocus();
- }
- //------------------------------------------------------------
-
- void __fastcall TMainForm::FormActivate(TObject *Sender)
- {
- const char* String1 = "You are about to build the VCL table!";
- if (InitializedTable) return;
- if (!VCLTable->RecordCount) {
- Enabled = false;
- if (::MessageBox(0, String1,
- "Attention", MB_OKCANCEL) == IDCANCEL) {
- Enabled = true;
- return;
- }
- Enabled = true;
- RebuildVCLTabMi(Sender);
- }
- InitializedTable = true;
- LoadClasses();
- }
- //------------------------------------------------------------
-
- void TMainForm::GetRegInfo()
- {
- String BCBPath;
- const String KeyStr = "\\software\\borland\\C++Builder\\3.0";
- TRegistry *MyRegistry = new TRegistry();
- MyRegistry->RootKey = HKEY_LOCAL_MACHINE;
-
- try {
- if (MyRegistry->OpenKey(KeyStr, false)) {
- BCBPath = MyRegistry->ReadString("RootDir");
- if (!BCBPath.IsEmpty()) {
- LocalVclSource = BCBPath + "\\source\\";
- LocalVclHeaders = BCBPath + "\\include\\vcl\\";
- LocalTablesDir = BCBPath + "\\examples\\classbrw\\";
- }
- else ShowMessage("Failed to read RootDir");
- MyRegistry->CloseKey();
- }
- else ShowMessage("Couldn't open key " + KeyStr);
- }
- catch(ERegistryException &E) {
- ShowMessage(E.Message);
- delete MyRegistry;
- return;
- }
- delete MyRegistry;
- }
-
- void TMainForm::WriteRegKeys()
- {
- // Check for registry keys and create if no exist
- const String Key1 = "\\software\\borland\\VCL Object Browser\\colors";
- const String Key2 = "\\software\\borland\\VCL Object Browser\\fonts";
- const String Key3 = "\\software\\borland\\VCL Object Browser\\fonts\\size";
-
- TRegistry *MyRegistry = new TRegistry();
-
- try {
- MyRegistry->RootKey = HKEY_LOCAL_MACHINE;
- if (!MyRegistry->KeyExists(Key1)) {
- if(MyRegistry->OpenKey(Key1, True)) {
- // note 16777215 is the color white default for background
- MyRegistry->WriteString("Declaration", "16777215");
- MyRegistry->WriteString("Definition", "16777215");
- MyRegistry->WriteString("DefinitionPage", "16777215");
- MyRegistry->WriteString("Grid", "16777215");
- MyRegistry->WriteString("HeaderPage", "16777215");
- MyRegistry->WriteString("MemberList", "16777215");
- MyRegistry->WriteString("QuickClass", "16777215");
- MyRegistry->CloseKey();
- }
- }
- if (!MyRegistry->KeyExists(Key2)) {
- if (MyRegistry->OpenKey(Key2, True)) {
- // note 0 is the default font color black
- MyRegistry->WriteString("Declaration", "0");
- MyRegistry->WriteString("Definition", "0");
- MyRegistry->WriteString("DefinitionPage", "0");
- MyRegistry->WriteString("Grid", "0");
- MyRegistry->WriteString("HeaderPage", "0");
- MyRegistry->WriteString("MemberList", "0");
- MyRegistry->WriteString("QuickClass", "0");
- MyRegistry->CloseKey();
- }
- }
- if (!MyRegistry->KeyExists(Key3)) {
- if (MyRegistry->OpenKey(Key3, True)) {
- // note 8 is default font size
- MyRegistry->WriteString("Declaration", "8");
- MyRegistry->WriteString("Definition", "8");
- MyRegistry->WriteString("DefinitionPage", "8");
- MyRegistry->WriteString("Grid", "8");
- MyRegistry->WriteString("HeaderPage", "8");
- MyRegistry->WriteString("MemberList", "8");
- MyRegistry->WriteString("QuickClass", "8");
- MyRegistry->CloseKey();
- }
- }
- }
- catch(ERegistryException &E) {
- ShowMessage(E.Message);
- delete MyRegistry;
- return;
- }
- delete MyRegistry;
- }
-
-
- void __fastcall TMainForm::RebuildVCLTabMi(TObject *Sender)
- {
- String Password;
- String OneChar;
- String Line;
- String HeaderName;
- int CharCount;
- int pcg;
- int hCount = 0;
- int TotFiles = 0;
- bool end = false;
- bool last = false;
- bool CLast = false;
- bool SelectOK = false;
- bool GotPasName = false;
- bool ValidHeader = false;
- TSearchEngine *PasFileSearch;
- WIN32_FIND_DATA fd;
- HANDLE hFile = NULL;
- String HeadersChar = LocalVclHeaders + "*.h*";
- ClassLB->Clear();
-
- try {
- ParsingHeaders = true;
-
- // Set a password if desired
- if (VCLTable->RecordCount !=0 ) {
- Password = "Rebuild";
- SelectOK = InputQuery("Enter Password",
- "Warning Rebuilding VCL table!!",Password);
- if (!SelectOK) return;
- else
- if (Password != "Rebuild") return;
- }
-
- // Show progress form
- TabRebuildStats = new TTabRebuildStats(this);
- TabRebuildStats->HeaderBar->Show();
- TabRebuildStats->TotalBar->Show();
- TabRebuildStats->ParseLabel->Show();
- TabRebuildStats->TotalLab->Show();
- TabRebuildStats->HeaderLab->Show();
- TabRebuildStats->Caption = "Building VCL Table";
- TabRebuildStats->Left = ceil((ClientWidth/2)-
- (TabRebuildStats->Width/2));
- TabRebuildStats->Top = ceil((ClientHeight/2)-
- (TabRebuildStats->Height/2));
- TabRebuildStats->Show();
- Enabled = false;
- TabRebuildStats->HeaderBar->Position = 1;
- TabRebuildStats->HeaderLab->Caption = "emptying table";
- Application->ProcessMessages();
-
- // Empty the VCL table if necessary
- VCLTable->Close();
- try {
- VCLTable->EmptyTable();
- }
- catch (EDatabaseError& E) {
- ShowMessage(E.Message + "Recopy vcltable.* files from cd!");
- Screen->Cursor = crDefault;
- TabRebuildStats->Hide();
- return;
- }
-
- // Empty classes.db Fill up during parse
- ClassListTab->Close();
- try {
- ClassListTab->EmptyTable();
- }
- catch (EDatabaseError& E) {
- ShowMessage(E.Message + "Recopy vcltable.* files from cd!");
- }
- ClassListTab->Open();
-
- // Start header parsing process
- VCLTable->Open();
- Screen->Cursor = crHourGlass;
- DestTable->DisableControls();
- PasFileSearch = new TSearchEngine();
-
- // find out how many file are in dir
- while (!end) {
- if (!hFile) hFile = FindFirstFile(HeadersChar.c_str(), &fd);
- else{
- CLast = FindNextFile(hFile, &fd);
- if (!CLast) break;
- }
- TotFiles++;
- }
-
- hFile = NULL;
- end = false;
- while (!end) {
- if (!hFile) hFile = FindFirstFile(HeadersChar.c_str(), &fd);
- else {
- last = FindNextFile(hFile, &fd);
- if (!last) break;
- }
-
- HeaderName = String(fd.cFileName);
- TabRebuildStats->HeaderLab->Caption = HeaderName;
- CharCount = 0;
- GotPasName = false;
- PasFileName = "";
- OneChar = "";
- CurrentHeader = HeaderName;
- hppFileRE->Clear();
- ValidHeader = true;
- if (HeaderName.LowerCase() == "utilcls.h") ValidHeader = false;
- try {
- hppFileRE->Lines->LoadFromFile
- (LocalVclHeaders + CurrentHeader);
- TabRebuildStats->HeaderBar->Max =
- static_cast<Word>(
- hppFileRE->Lines->Count);
- TabRebuildStats->HeaderBar->Position = 1;
- Application->ProcessMessages();
- }
- catch(EFOpenError& E) {
- ValidHeader = false;
- }
-
- if (ValidHeader) {
- // get pas file name
- pasFileRE->Clear();
- PasFileSearch->SearchForString(".pas", 1, 0,
- "Include");
- if (PasFileSearch->PosFound!=-1) {
- Line = hppFileRE->Lines->
- Strings[PasFileSearch->LineNumFound];
- while (!GotPasName) {
- OneChar = Line.SubString((PasFileSearch->PosFound) -
- (PasFileSearch->LinePosOne) - CharCount, 1);
- GotPasName =((OneChar == " ") || (OneChar == "/") ||
- (OneChar == "'"));
- if (!GotPasName) {
- AppendStr(OneChar ,PasFileName);
- PasFileName = OneChar;
- CharCount++;
- }
- }
- AppendStr(PasFileName,".pas");
- }
- DestTable->Close();
- DestTable->TableName = "main2.db";
- DestTable->Open();
- DestTable->Close();
- DestTable->EmptyTable();
- DestTable->Open();
- HppToDestTable();
- Screen->Cursor = crDefault;
- BatchMove1->Execute();
- hCount++;
- }
- pcg = ((float)hCount / (float)TotFiles) * 100;
- if (pcg) {
- TabRebuildStats->TotalLab->Caption =
- IntToStr(pcg) + " %";
- TabRebuildStats->TotalBar->Position = pcg;
- Application->ProcessMessages();
- }
- }
-
- // clean up
- DestTable->Close();
- DestTable->EnableControls();
- Screen->Cursor=crDefault;
- TabRebuildStats->Hide();
- VCLTable->Close();
- VCLTable->TableName = "vcltable.db";
- VCLTable->Open();
- VCLTable->Refresh();
- RawVCLTable->Refresh();
- Grid->Refresh();
- RawVCLTable->First();
- ShowMessage("Successful Build");
- Enabled = true;
- ParsingHeaders = false;
- }
- catch(...) {
- ShowMessage("Corrupt Table! Recopy vcltable.* files from cd!");
- delete TabRebuildStats;
- return;
- }
- LoadClasses();
- delete TabRebuildStats;
- delete PasFileSearch;
- }
- //------------------------------------------------------------
-
- // Using the dest table that handles 1 header file parsement
- void TMainForm::ConvertTableToTabs()
- {
- // run a query to get class names
- MembersLV->Items->Clear();
- DestTabQry->Close();
- DestTabQry->Open();
- ClearTabs();
-
- // Create tabs from query
- while (!DestTabQry->Eof) {
- TTabSheet *NewTabSheet = new TTabSheet(this);
- NewTabSheet->Caption = DestTabQryClassName->AsString;
- NewTabSheet->PageControl= MembPgCtl;
- MembersLV->Parent = NewTabSheet;
- MembersLV->Align = alClient;
- DestTabQry->Next();
- }
- }
-
- void __fastcall TMainForm::SelectATab(TObject *Sender)
- {
- // Handle tab select event
- if (DeleteTabs) return;
- MembersLV->Parent = MembPgCtl->ActivePage;
- MembersLV->Align = alClient;
- MembersLV->ViewStyle = vsList;
- Application->ProcessMessages();
- Screen->Cursor = crHourGlass;
- CurrentTab = MembPgCtl->ActivePage->Caption;
- ClassLBSel = CurrentTab;
-
- // Filter the VCL table with the tab caption
- RawVCLTable->DisableControls();
- RawVCLTable->Filtered = false;
- RawVCLTable->SetRange(OPENARRAY(TVarRec,(CurrentTab)),
- OPENARRAY(TVarRec,(CurrentTab)));
-
- CurrentHeader = RawVCLTable->
- FieldByName("Header")->AsString;
-
- CurrentSource = RawVCLTable->
- FieldByName("Misc")->AsString;
-
- // Load the header.hpp and source.cpp files
- DeclareRE->Clear();
- DefineRE->Clear();
- hppFileRE->Clear();
- try {
- hppFileRE->Lines->
- LoadFromFile(LocalVclHeaders + CurrentHeader);
- HeaderTab->Caption = CurrentHeader;
- }
- catch (EFOpenError& E) {
- ShowMessage(E.Message);
- Screen->Cursor = crDefault;
- return;
- }
- pasFileRE->Clear();
- LoadSourcePage();
- TableToListStrings(CurrentTab);
- MembersLV->Repaint();
- Application->ProcessMessages();
- RawVCLTable->EnableControls();
- Screen->Cursor = crDefault;
- }
- //------------------------------------------------------------
-
- void TMainForm::TableToListStrings(const String ClassName)
- {
- int q;
- int ParamNum;
- String FinalString;
- String RecClassName;
- String MemberName;
- String MemberType;
- String ReturnType;
- String ScopeColor;
- String PType[8];
- String PObject[8];
- String pt = "PType";
- String ot = "PObject";
- String TPos;
- String OPos;
- bool Break;
- bool DataProperty;
- TListItem *NewItem;
-
- // initialize
- Break = false;
- MembersLV->Items->Clear();
-
- // since our table has been filtered to only show one class with
- // with all its members, lets extract the class members one record at a time.
-
- while ((!Break) && (!RawVCLTable->Eof)) {
- FinalString = "";
- RecClassName = RawVCLTable->FieldByName("ClassName")->AsString;
-
- // get class member info from table
- if (ClassName == RecClassName) {
- ReturnType = RawVCLTable->FieldByName("ReturnType")->AsString;
- MemberName = RawVCLTable->FieldByName("MemberName")->AsString;
- MemberType = RawVCLTable->FieldByName("Member")->AsString;
- ScopeColor = RawVCLTable->FieldByName("Scope")->AsString;
- ParamNum = RawVCLTable->FieldByName("Ps")->AsInteger;
- DataProperty = ((MemberType == "property") && (!ParamNum));
-
- // Start building a ListView item String from table info
- // obtained from above and assign an image index
- FinalString = "";
-
- // if not a function do this
- if ((MemberType == "data") || (DataProperty)) {
- AppendStr(FinalString, MemberName);
- NewItem = MembersLV->Items->Add();
- NewItem->Caption = FinalString;
- NewItem->ImageIndex = FindImageIndex(ScopeColor, MemberType);
- }
- // else if it is a function with only a void parameter
- else {
- if (ParamNum == 0) {
- AppendStr(FinalString, MemberName);
- if (MemberType == "property")
- AppendStr(FinalString, " ={");
- else AppendStr(FinalString, " (");
- }
-
- // build a function String that has parameters from 0 to 8
- if (ParamNum > 0) {
- PType[0] = RawVCLTable->FieldByName("PType1")->AsString;
- PObject[0] = RawVCLTable->FieldByName("PObject1")->AsString;
- AppendStr(FinalString, MemberName);
- if (MemberType == "property") AppendStr(FinalString," ={");
- else AppendStr(FinalString, " (");
- AppendStr(FinalString, PType[0]);
- AppendStr(FinalString, " ");
- AppendStr(FinalString, PObject[0]);
- }
-
- for (q = 1; q < 8; q++) {
- if (ParamNum > q) {
- TPos = pt + IntToStr(q + 1);
- OPos = ot + IntToStr(q + 1);
- PType[q] = RawVCLTable->FieldByName(TPos)->AsString;
- PObject[q] = RawVCLTable->FieldByName(OPos)->AsString;
- AppendStr(FinalString, ",");
- AppendStr(FinalString, PType[q]);
- AppendStr(FinalString, " ");
- AppendStr(FinalString, PObject[q]);
- }
- }
- // handle properties differently
- if (MemberType == "property") AppendStr(FinalString," }");
- else AppendStr(FinalString," )");
-
- // Add the member to the member listbox
- NewItem = MembersLV->Items->Add();
- NewItem->Caption = FinalString;
- NewItem->ImageIndex = FindImageIndex(ScopeColor, MemberType);
- }
- RawVCLTable->Next();
- }
- else Break = true;
- }
- }
-
- void __fastcall TMainForm::MembersLVClick(TObject *Sender)
- {
- String MemberType;
- String RetTypeSel;
- String ParamArray[7];
- int ParamQty;
- if ((!MembersLV->ItemFocused) || (MembersLV-> ItemFocused->Caption == "Class Member List"))
- return;
- else
- CurrentTab=MembPgCtl->ActivePage->Caption;
- RawVCLTable->DisableControls();
- RawVCLTable->First();
-
- // Take selected item and find in table
- StringToTablePos(MembersLV->ItemFocused->Caption,
- CurrentTab);
-
- // Once record found, get certain field values
- MemberNameSel = RawVCLTable->
- FieldByName("MemberName")->AsString;
- RetTypeSel = RawVCLTable->
- FieldByName("ReturnType")->AsString;
- LoadDeclCode(RetTypeSel + MembersLV->ItemFocused->
- Caption);
- MemberType = RawVCLTable->
- FieldByName("Member")->AsString;
- ParamQty = RawVCLTable->
- FieldByName("Ps")->AsInteger;
- ParamArray[0] = RawVCLTable->
- FieldByName("PType1")->AsString;
- ParamArray[1] = RawVCLTable->
- FieldByName("PType2")->AsString;
- ParamArray[2] = RawVCLTable->
- FieldByName("PType3")->AsString;
- ParamArray[3] = RawVCLTable->
- FieldByName("PType4")->AsString;
- ParamArray[4] = RawVCLTable->
- FieldByName("PType5")->AsString;
- ParamArray[5] = RawVCLTable->
- FieldByName("PType6")->AsString;
- ParamArray[6] = RawVCLTable->
- FieldByName("PType7")->AsString;
- ParamArray[7] = RawVCLTable->
- FieldByName("PType8")->AsString;
- String HeaderType = RawVCLTable->
- FieldByName("Header")->AsString;
-
- // Load the Declaration and definition
- if ((HeaderType.LowerCase() == "dstring.h") ||
- (HeaderType.LowerCase() == "sysdefs.h") ||
- (HeaderType.LowerCase() == "wstring.h"))
- LoadCppDef(ParamArray, ParamQty);
- else
- LoadPasCode(MemberType, RetTypeSel +
- MembersLV->ItemFocused->Caption);
- Screen->Cursor = crDefault;
- RawVCLTable->EnableControls();
- }
- //------------------------------------------------------------
- void TMainForm::StringToTablePos(const String SelectedText, const String ClassName)
- {
- bool Match = false;
- bool DataProperty;
- int q;
- int ParamNum;
- String FinalString;
- String RecClassName;
- String MemberName;
- String MemberType;
- String ReturnType;
- String PType[8];
- String PObject[8];
- String pt = "PType";
- String ot = "PObject";
- String TPos;
- String OPos;
-
- // since the table is still filtered to show only the class members
- // letÆs iterate thru the table piecing together each record and comparing
- // it with the ListView selection until we find a match.
-
- while ((!RawVCLTable->Eof) && (!Match)) {
- FinalString = "";
- ReturnType = RawVCLTable->FieldByName("ReturnType")->AsString;
- MemberName = RawVCLTable->FieldByName("MemberName")->AsString;
- MemberType = RawVCLTable->FieldByName("Member")->AsString;
- RecClassName = RawVCLTable->FieldByName("ClassName")->AsString;
- ParamNum = RawVCLTable->FieldByName("Ps")->AsInteger;
-
- // Is it a data property
- DataProperty = ((MemberType == "property") && (!ParamNum));
- if (ClassName == RecClassName) {
- FinalString = "";
- // if data member
- if ((MemberType == "data") || (DataProperty))
- AppendStr(FinalString, MemberName);
- else {
- // Start building String from table info
- if (ParamNum == 0) {
- AppendStr(FinalString, MemberName);
- if (MemberType == "property")
- AppendStr(FinalString, " ={");
- else AppendStr(FinalString, " (");
- }
-
- // if the member has parameters
- if (ParamNum > 0) {
- PType[0] = RawVCLTable->FieldByName("PType1")->AsString;
- PObject[0] = RawVCLTable->FieldByName("PObject1")->AsString;
- AppendStr(FinalString, MemberName);
- if (MemberType == "property")
- AppendStr(FinalString, " ={");
- else AppendStr(FinalString, " (");
- AppendStr(FinalString, PType[0]);
- AppendStr(FinalString, " ");
- AppendStr(FinalString, PObject[0]);
- }
-
- //for parameters greater than 1
- for (q = 1; q < 8; q++) {
- if (ParamNum > q) {
- TPos = pt + IntToStr(q + 1);
- OPos = ot + IntToStr(q + 1);
- PType[q] = RawVCLTable->FieldByName(TPos)->AsString;
- PObject[q] = RawVCLTable->FieldByName(OPos)->AsString;
- AppendStr(FinalString, ",");
- AppendStr(FinalString, PType[q]);
- AppendStr(FinalString, " ");
- AppendStr(FinalString, PObject[q]);
- }
- }
-
- if (MemberType == "property")
- AppendStr(FinalString," }");
- else AppendStr(FinalString," )");
- }
- }
- //here is where we compare for a match
- Match = SelectedText == FinalString;
- if (!Match) RawVCLTable->Next();
- }
- RawVCLTable->EnableControls();
- }
-
- void TMainForm::LoadClasses()
- {
- // Load up VCL class list
- ClassLB->Clear();
- ClassListTab->Open();
- ClassListTab->First();
-
- // iterate through the table
- while (!ClassListTab->Eof) {
- ClassLB->Items->Add(ClassListTabClassName->AsString);
- ClassListTab->Next();
- }
- // if ClassLB has multiselect set to true highlight first
- ClassLB->Perform(LB_SETSEL,true,0);
- }
-
- void TMainForm::HppToDestTable()
- {
- bool OneLinerClass;
- bool DerivedClass;
- bool CommentLine;
- bool Break;
- bool Done;
- bool a;
- bool b;
- bool c;
- int x;
- int p;
- int StrLength;
- int CopyLength;
- int FirstSearch;
- int EndOfSearch;
- long ComLinePos;
- String OneLineOfCode;
- String ExtractClass;
- String OneChar;
- String TempString;
- SecondClass = "";
- EndOfSearch = 0;
- FirstSearch = 0;
- TSearchEngine *ClassSearch = new TSearchEngine();
- TSearchEngine *CommentSearch = new TSearchEngine();
- ClassSearch->LineNumFound =0;
- CommentSearch->LineNumFound =0;
- ClassSearch->PosFound = 0;
- CommentSearch->PosFound = 0;
- ClearTabs();
-
- // Extracting Class names
- while (EndOfSearch!=-1) {
- if (ParsingHeaders) ClassListTab->Append();
- OneLinerClass = false;
- DerivedClass = false;
- Break = false;
- ExtractClass = "";
- // Find "class" from pos 0
- ClassSearch->SearchForString("class ", 1, FirstSearch, "Include");
- TabRebuildStats->HeaderBar->Position =
- static_cast<Word>(ClassSearch->LineNumFound);
-
- // Is class line a comment line
- CommentSearch->SearchForString("//", 1,
- ClassSearch->LinePosOne, "Include");
- CommentLine = ClassSearch->LineNumFound==
- CommentSearch->LineNumFound;
- if (!CommentLine) {
- CommentSearch->SearchForString("/*", 1,
- ClassSearch->LinePosOne, "Include");
- CommentLine = ClassSearch->LineNumFound==
- CommentSearch->LineNumFound;
- }
-
- a = CommentLine;
- b = ClassSearch->PosFound < CommentSearch->PosFound;
- c = ClassSearch->PosFound == -1;
- if (c) {
- CommentSearch->PosFound = 999999;
- TabRebuildStats->HeaderBar->Position =
- TabRebuildStats->HeaderBar->Max;
- }
- if ((a && b && !c) || (!a && !c)) {
- OneLineOfCode = hppFileRE->Lines->
- Strings[ClassSearch->LineNumFound];
- StrLength = OneLineOfCode.Length();
-
- // skip blank lines
- while (!StrLength) {
- OneLineOfCode = hppFileRE->
- Lines->Strings[ClassSearch->LineNumFound +1 ];
- StrLength = OneLineOfCode.Length();
- }
- if (CommentLine) {
- ComLinePos = CommentSearch->PosFound -
- CommentSearch->LinePosOne;
- OneLineOfCode = hppFileRE->
- Lines->Strings[ClassSearch->LineNumFound];
- OneLineOfCode = OneLineOfCode.SubString(0,
- ComLinePos);
- StrLength = OneLineOfCode.Length();
- }
-
- // check for template classes
- if (OneLineOfCode.Pos("template")) Break = true;
- if (OneLineOfCode.Pos("class DELPHIRETURN OleVariant")) Break = true;
- if (OneLineOfCode.Pos(".")) Break = true;
-
- // check for forward declaration
- for (p = 1; p <= StrLength+1; p++) {
- OneChar = OneLineOfCode.SubString(p, 1);
-
- if (OneChar == ";") Break = true;
- if (OneChar == ":") DerivedClass = true;
- if (OneChar == "{") OneLinerClass = true;
- }
-
- // extract derived class
- if (DerivedClass) {
- // Get the 2nd derivation class name
- CopyLength = StrLength;
- TempString = "";
- Done = false;
- SecondClass = "";
- while (!Done) {
- TempString = OneLineOfCode.SubString(CopyLength, 1);
- if (TempString == ":") Done = true;
- if ((TempString == " ") && (CopyLength != StrLength)) Done = true ;
- if ((TempString != "{") && (!Done) && (TempString != " ")) {
- AppendStr(TempString, SecondClass);
- SecondClass = TempString;
- }
- CopyLength--;
- }
- // Get Class Name
- x = 1;
- while ((x!=StrLength+1) && (!Break)) {
- OneChar = "";
- OneChar = OneLineOfCode.SubString(x, 1);
- if (OneChar == ":") {
- OneChar = " ";
- x = x-1;
- OneChar = OneLineOfCode.SubString(x, 1);
- while (OneChar == " ") {
- x--;
- OneChar = OneLineOfCode.SubString(x, 1);
- }
- while (OneChar!=" ") {
- OneChar = OneLineOfCode.SubString(x, 1);
- x--;
- }
- x = x+2;
- OneChar = OneLineOfCode.SubString(x, 1);
- while ((OneChar != " ") && (OneChar != ":")) {
- ExtractClass = ExtractClass + OneChar;
- x++;
- OneChar = OneLineOfCode.SubString(x, 1);
- }
- Break = true;
- TabRebuildStats->ClassLab->Caption =
- ExtractClass;
- if (ParsingHeaders) {
- ClassListTabClassName->AsString =
- ExtractClass;
- ClassListTab->Post();
- }
- Application->ProcessMessages();
- ExtractClassMembers(ClassSearch->PosFound,
- ExtractClass);
- }
- x++;
- }
- SecondClass="";
- }
-
- // This is a base class type
- if ((!DerivedClass) && (OneLinerClass)) {
- x = 1;
- while ((x!=StrLength+1) && (!Break)) {
- OneChar = "";
- OneChar = OneLineOfCode.SubString(x, 1);
- if (OneChar == "{") {
- x = x-1;
- OneChar = OneLineOfCode.SubString(x, 1);
- while (OneChar == " ") {
- x--;
- OneChar = OneLineOfCode.SubString(x, 1);
- }
- while (OneChar!=" ") {
- OneChar = OneLineOfCode.SubString(x, 1);
- x--;
- }
- x = x+2;
- OneChar = OneLineOfCode.SubString(x, 1);
- while ((OneChar!=" ") && (OneChar!="{")) {
- ExtractClass = ExtractClass + OneChar;
- x++;
- OneChar = OneLineOfCode.SubString(x, 1);
- }
- Break = true;
- TabRebuildStats->ClassLab->Caption =
- ExtractClass;
- if (ParsingHeaders) {
- ClassListTabClassName->AsString =
- ExtractClass;
- ClassListTab->Post();
- }
- Application->ProcessMessages();
- ExtractClassMembers(ClassSearch->PosFound,
- ExtractClass);
- }
- x++;
- }
- }
-
- // Start of two line class declaration
- if ((!OneLinerClass) && (!DerivedClass) &&
- (!Break)) {
- x = StrLength;
- OneChar = OneLineOfCode.SubString(x, 1);
- while (OneChar == " ") {
- x--;
- OneChar = OneLineOfCode.SubString(x,1);
- }
- while (OneChar != " ") {
- OneChar = OneLineOfCode.SubString(x, 1);
- x--;
- }
- x = x + 2;
- OneChar = OneLineOfCode.SubString(x, 1);
- while (x != StrLength + 1) {
- ExtractClass = ExtractClass + OneChar;
- x++;
- OneChar = OneLineOfCode.SubString(x, 1);
- }
- TabRebuildStats->ClassLab->Caption=
- ExtractClass;
- if (ParsingHeaders) {
- ClassListTabClassName->AsString =
- ExtractClass;
- ClassListTab->Post();
- }
- Application->ProcessMessages();
- ExtractClassMembers(ClassSearch->PosFound,
- ExtractClass);// 2 line class
- }
- }
-
- EndOfSearch = ClassSearch->PosFound;
- FirstSearch = ClassSearch->NewSearchPos;
- }
- TObject* Sender = new TObject();
- if (!ParsingHeaders) {
- ConvertTableToTabs();
- SelectATab(Sender);
- }
- delete Sender;
- delete ClassSearch;
- delete CommentSearch;
- }
-
- void TMainForm::ExtractClassMembers(const int ClassPosition,
- const String ClassName) {
- String ScopeLab[4]= {"public:", "__published:", "protected:",
- "private:"};
- String AMember;
- String ClassMember;
- String OneChar;
- bool HasScopes[4];
- bool OneScopeDone;
- bool FoundEnd;
- bool Break;
- bool FoundOpenBrkt;
- bool FoundEqual;
- int ScopeLine;
- int StrLength;
- int LineLength;
- int MembersCount;
- int MyCount;
- int MoreMembers;
- int b;
- int n;
- int r;
- int x;
- int sc;
- int EndBracket;
- long MemberPosOne;
- long P[4];
- long L[4];
- long q;
- long h;
- TSearchEngine *ScopeMembers[4];
- ScopeMembers[0] = new TSearchEngine();
- ScopeMembers[1] = new TSearchEngine();
- ScopeMembers[2] = new TSearchEngine();
- ScopeMembers[3] = new TSearchEngine();
- TSearchEngine *BeginClassBracket = new TSearchEngine();
- AMember = "";
- Break = false;
- MyCount = 0;
- FoundOpenBrkt = false;
-
- // After we found a valid class, lets find the scope ops
- BeginClassBracket->SearchForString("{", 1, ClassPosition,
- "Include");
- ScopeMembers[0]->SearchForString("public:", 1,
- ClassPosition,"Include");
- ScopeMembers[1]->SearchForString("__published:", 1,
- ClassPosition,"Include");
- ScopeMembers[2]->SearchForString("protected:", 1,
- ClassPosition,"Include");
- ScopeMembers[3]->SearchForString("private:", 1,
- ClassPosition,"Include");
- b = BeginClassBracket->LineNumFound;
- MoreMembers = 2;
- DestTable->Close();
- DestTable->TableName = "main2.db";
- DestTable->Open();
-
- // Once in the class find first and last {}
- while (!Break) {
- x = 1;
- StrLength = hppFileRE->Lines->
- Strings[b].Length();
- while ((x != StrLength+1) && (!Break)) {
- OneChar = hppFileRE->Lines->
- Strings[b].SubString(x, 1);
- if (OneChar == "{") {
- FoundOpenBrkt = true;
- MyCount = MyCount + 1;
- }
- if (OneChar == "}") MyCount = MyCount-1;
- x++;
- Break = (!MyCount) && (FoundOpenBrkt);
- }
- b++;
- }
- b=b-1;
-
- MemberPosOne = hppFileRE->
- Perform(EM_LINEINDEX, b, 0);
- // Need to know where class ends
- EndBracket = MemberPosOne + (x-1);
- P[0] = ScopeMembers[0]->PosFound;
- P[1] = ScopeMembers[1]->PosFound;
- P[2] = ScopeMembers[2]->PosFound;
- P[3] = ScopeMembers[3]->PosFound;
- HasScopes[0] = (P[0] < EndBracket) && (P[0] != -1);
- HasScopes[1] = (P[1] < EndBracket) && (P[1] != -1);
- HasScopes[2] = (P[2] < EndBracket) && (P[2] != -1);
- HasScopes[3] = (P[3] < EndBracket) && (P[3] != -1);
- L[0] = ScopeMembers[0]->LineNumFound;
- L[1] = ScopeMembers[1]->LineNumFound;
- L[2] = ScopeMembers[2]->LineNumFound;
- L[3] = ScopeMembers[3]->LineNumFound;
-
- for (sc = 0; sc < 4; sc++) {
- while (HasScopes[sc]) {
- n = 1;
- OneScopeDone = false;
- while (!OneScopeDone) {
- switch (sc) { // Check if pos is within class
- case 0:
- q = L[0] + n;
- if ((q == L[1]) || (q == L[2]) || (q == L[3])
- || (q == b)) OneScopeDone = true;
- break;
- case 1:
- q = L[1] + n;
- if ((q == L[0]) || (q == L[2]) ||(q == L[3])
- || (q == b)) OneScopeDone = true;
- break;
- case 2:
- q = L[2] + n;
- if ((q == L[0]) || (q == L[1]) ||(q == L[3])
- || (q == b)) OneScopeDone = true;
- break;
- case 3:
- q = L[3] + n;
- if ((q == L[0]) || (q == L[1]) ||(q == L[2])
- || (q == b)) OneScopeDone = true;
- break;
- }
- ClassMember = "";
- ClassMember = hppFileRE->Lines->
- Strings[L[sc] + n];
-
- if (ClassMember.Pos("public:") ||
- ClassMember.Pos("private:") ||
- ClassMember.Pos("__published:") ||
- ClassMember.Pos("protected:"))
- OneScopeDone = true;
- ScopeLine = L[sc] + n;
-
- // Is this a garbage line
- while (IsItABadLine(ClassMember,ScopeLine)) {
- ClassMember = hppFileRE->
- Lines->Strings[L[sc] + n + 1];
- if (ClassMember.Pos("public:") ||
- ClassMember.Pos("private:") ||
- ClassMember.Pos("__published:") ||
- ClassMember.Pos("protected:"))
- OneScopeDone = true;
- switch (sc) {
- case 0:
- h = L[0] + n + 1;
- if ((h == L[1]) || (h == L[2]) || (h == L[3])
- || (h == b)) OneScopeDone = true;
- break;
- case 1:
- h = L[1] + n + 1;
- if ((h == L[0]) || (h == L[2]) ||(h == L[3])
- || (h == b)) OneScopeDone = true;
- break;
- case 2:
- h = L[2] + n + 1;
- if ((h == L[0]) || (h == L[1]) ||(h == L[3])
- || (h == b)) OneScopeDone = true;
- break;
- case 3:
- h = L[3] + n + 1;
- if ((h == L[0]) || (h == L[1]) ||(h == L[2])
- || (h == b)) OneScopeDone = true;
- break;
- }
- ScopeLine = L[sc] + n + 1;
- n++;
- }
-
- if (!OneScopeDone) {
- FoundEqual = false;
- FoundEnd = false;
- MembersCount = 1;
- // Append multiple line functions
- while (!FoundEnd) {
- LineLength = ClassMember.Length();
- for (r = 1; r <= (LineLength + 1); r++) {
- OneChar = ClassMember.SubString(r, 1);
- if (OneChar == "=") FoundEqual = true;
- if (OneChar == ";") FoundEnd = true;
- if ((OneChar == "}") && (!FoundEqual))
- FoundEnd = true;
- }
- if (!FoundEnd) ClassMember = ClassMember +
- hppFileRE->Lines->
- Strings[L[sc] + n + MembersCount];
- MembersCount++;
- }
- String Temp = ScopeLab[sc].SubString(1,
- ScopeLab[sc].Length() -1);
- MemberToTable(ClassMember,Temp,
- ClassName, ScopeLine);
- }
- n = n + MembersCount - 2;
- n++;
- }
- // Are the scopes declared more than once
- HasScopes[sc] = false;
- ScopeMembers[sc]->SearchForString(ScopeLab[sc],
- MoreMembers, ClassPosition, "Include");
- if ((ScopeMembers[sc]->PosFound < EndBracket) &&
- (ScopeMembers[sc]->PosFound != -1)) {
- HasScopes[sc] = true;
- MoreMembers++;
- P[0] = ScopeMembers[0]->PosFound;
- P[1] = ScopeMembers[1]->PosFound;
- P[2] = ScopeMembers[2]->PosFound;
- P[3] = ScopeMembers[3]->PosFound;
- HasScopes[0] = (P[0] < EndBracket) && (P[0] != -1);
- HasScopes[1] = (P[1] < EndBracket) && (P[1] != -1);
- HasScopes[2] = (P[2] < EndBracket) && (P[2] != -1);
- HasScopes[3] = (P[3] < EndBracket) && (P[3] != -1);
- L[0] = ScopeMembers[0]->LineNumFound;
- L[1] = ScopeMembers[1]->LineNumFound;
- L[2] = ScopeMembers[2]->LineNumFound;
- L[3] = ScopeMembers[3]->LineNumFound;
- }
- }
- }
- delete[] ScopeMembers;
- delete BeginClassBracket;
- }
-
- void TMainForm::MemberToTable(const String MemberDeclaration,
- const String MyScope, const String CppClassName,
- const int MemberLineNumber)
- {
- // Get all vcltable fields info and post to table
- int k;
- int v;
- int StrLength;
- int y;
- int IsItAProperty;
- int Len;
- long MemberPosOne;
- int Temp;
- int Temp2;
- long Temp3;
-
- bool EndOfParams;
- bool Break;
- bool IsItAFunction;
- bool a;
- bool b;
- bool c;
- bool d;
- bool e;
- String OneChar;
- String ClassMemberName;
- String ObjectNames[8];
- String ObjectTypes[8];
- TExtractObjects *ExtractObjects;
- TSearchEngine *MemberCommentSearch;
-
- if (MemberDeclaration.Pos("operator")) IsOperator = true;
- DestTable->Append();
- MemberCommentSearch = new TSearchEngine();
- ExtractObjects = new TExtractObjects();
- IsItAFunction = false;
- Break = false;
- StrLength = MemberDeclaration.Length();
- y = 1;
- IsItAProperty = MemberDeclaration.Pos("__property");
-
- while ((y != StrLength+1) && (!Break)) {
- OneChar = "";
- OneChar = MemberDeclaration.SubString(y, 1);
- a = OneChar == "(";
- b = y == StrLength;
- c = OneChar == "=";
- d = !IsOperator;
- e = OneChar == "[";
-
- // For data and function members
- if ((a) || (b) || ((c) && (d)) || ((e) && (d))) {
- if (a) IsItAFunction = true;
- if (c) IsItAFunction = true;
-
- // skip comments and extract member type and name
- MemberPosOne = hppFileRE->
- Perform(EM_LINEINDEX, MemberLineNumber, 0);
- MemberCommentSearch->SearchForString("*/", 1,
- MemberPosOne, "Include");
- Temp = MemberDeclaration.Pos("*/");
- Temp2 = MemberDeclaration.Pos("/*");
- Temp3 = Temp + MemberPosOne -1;
- if (Temp == 0) {
- ExtractObjects->ExtractNameAndType(1 , y,
- MemberDeclaration, "MemberName");
- IsOperator = false;
- }
- else {
- // handle comments
- if(Temp3 == MemberPosOne + y - 2) { // if at end of line
- ExtractObjects->ExtractNameAndType(1 , Temp2,
- MemberDeclaration, "MemberName");
- IsOperator = false;
- }
- else { // Get name and type if at begin of line
- ExtractObjects->ExtractNameAndType(
- (MemberCommentSearch->PosFound -
- MemberPosOne) + 3,
- y, MemberDeclaration, "MemberName");
- IsOperator = false;
- }
- }
- OneChar = ExtractObjects->ObjectName.SubString(0, 1);
-
- // make sure pointers are on type side
- if (OneChar == "*") {
- Len = ExtractObjects->ObjectName.Length();
- ExtractObjects->ObjectName = ExtractObjects->
- ObjectName.SubString(2, Len);
- AppendStr(ExtractObjects->ObjectType, "*");
- }
-
- // Make sure references are on type side
- if (OneChar == "&") {
- Len = ExtractObjects->ObjectName.Length();
- ExtractObjects->ObjectName = ExtractObjects->
- ObjectName.SubString(2, Len);
- AppendStr(ExtractObjects->ObjectType, "&");
- }
- ClassMemberName = ExtractObjects->ObjectName;
- DestTableMemberName->AsString = ClassMemberName;
- TabRebuildStats->MemberLab->Caption = ClassMemberName;
- Application->ProcessMessages();
- DestTableReturnType->AsString = ExtractObjects->
- ObjectType;
- Break = true;
- EndOfParams = false;
- v = 0;
-
- // Extract parameters
- while ((!EndOfParams) && (v != StrLength+1)
- && (IsItAFunction)) {
- k = 0;
- v = y + 1;
- OneChar = MemberDeclaration.SubString(v, 1);
- if (OneChar == ")") EndOfParams = true;
- if (OneChar == "}") EndOfParams = true;
- ExtractObjects->LastCommaPosition = y;
- while (!EndOfParams) {
- OneChar = MemberDeclaration.SubString(v, 1);
- if (OneChar == ")") EndOfParams = true;
- if (OneChar == "}") EndOfParams = true;
- if ((OneChar == ",") || (OneChar == ")")
- || (OneChar == "}")) {
- ExtractObjects->ObjectName = "";
- ExtractObjects->ObjectType = "";
- ExtractObjects->ExtractNameAndType(
- ExtractObjects->LastCommaPosition +
- 1, v, MemberDeclaration, "Parameter");
- OneChar = ExtractObjects->
- ObjectName.SubString(0, 1);
- if (OneChar == "*") {
- Len = ExtractObjects->ObjectName.Length();
- ExtractObjects->ObjectName =
- ExtractObjects->
- ObjectName.SubString(2, Len);
- AppendStr(ExtractObjects->ObjectType, "*");
- }
- if (OneChar == "&") {
- Len = ExtractObjects->ObjectName.Length();
- ExtractObjects->ObjectName =
- ExtractObjects->
- ObjectName.SubString(2, Len);
- AppendStr(ExtractObjects->ObjectType, "&");
- }
- ObjectNames[k] = ExtractObjects->ObjectName;
- ObjectTypes[k] = ExtractObjects->ObjectType;
- k++;
- if (k==8) EndOfParams = true;
- }
- v++;
- }
- }
- // Load up table fields before doing a post
- DestTablePType1->AsString = ObjectTypes[0];
- DestTablePType2->AsString = ObjectTypes[1];
- DestTablePType3->AsString = ObjectTypes[2];
- DestTablePType4->AsString = ObjectTypes[3];
- DestTablePType5->AsString = ObjectTypes[4];
- DestTablePType6->AsString = ObjectTypes[5];
- DestTablePType7->AsString = ObjectTypes[6];
- DestTablePType8->AsString = ObjectTypes[7];
- DestTablePObject1->AsString = ObjectNames[0];
- DestTablePObject2->AsString = ObjectNames[1];
- DestTablePObject3->AsString = ObjectNames[2];
- DestTablePObject4->AsString = ObjectNames[3];
- DestTablePObject5->AsString = ObjectNames[4];
- DestTablePObject6->AsString = ObjectNames[5];
- DestTablePObject7->AsString = ObjectNames[6];
- DestTablePObject8->AsString = ObjectNames[7];
-
- // Clear for reuse
- for (int w = 0; w < 8; w++) {
- ObjectTypes[w] = "";
- ObjectNames[w] = "";
- }
-
- if (!IsItAFunction) DestTablePs->AsInteger = 0;
- if (IsItAFunction) DestTablePs->AsInteger = k;
- DestTableSecondClass->AsString = SecondClass;
- DestTableHeader->AsString = CurrentHeader;
- DestTableScope->AsString = MyScope;
- DestTableClassName->AsString = CppClassName;
- DestTableMisc->AsString = PasFileName;
- if (IsItAFunction) {
- if (CppClassName == ClassMemberName)
- DestTableMember->AsString = "constructor";
- else DestTableMember->AsString = "function";
- }
- if (!IsItAFunction) DestTableMember->AsString = "data";
- if (IsItAProperty) DestTableMember->AsString = "property";
- if ((ClassMemberName == String()) ||
- (DestTableReturnType->AsString == String()))
- DestTable->Cancel();
- else
- DestTable->Post();
- }
- y++;
- }
- delete ExtractObjects;
- delete MemberCommentSearch;
- }
-
- bool TMainForm::IsItABadLine(const String Line,
- const int DefinedLineNumber)
- {
- int Len;
- int x;
- long MemberPosOne;
- bool FoundSemicolon = false;
- bool FoundOpenBracket = false;
- bool BadLine = true;
- bool FoundPound = false;
- String OneChar;
- TSearchEngine *DefineLineSearch;
- DefineLineSearch = new TSearchEngine();
-
- // Garbage line detection
- Len = Line.Length();
- for (x = 1; x <= (Len+1); x++) {
- OneChar = Line.SubString(x, 1);
- if (OneChar == ";") FoundSemicolon = true;
- if (OneChar == "#") FoundPound = true;
- if ((OneChar == "(") || (OneChar == "{")) {
- FoundOpenBracket = true;
- MemberPosOne = hppFileRE->
- Perform(EM_LINEINDEX, DefinedLineNumber, 0);
- DefineLineSearch->SearchForString("define", 1,
- MemberPosOne, "Include");
- if ((DefineLineSearch->PosFound < MemberPosOne + x)
- && (DefineLineSearch->PosFound != -1) && (FoundPound))
- FoundOpenBracket = false;
- }
- }
- if (FoundSemicolon) BadLine = false;
- if (FoundOpenBracket) BadLine = false;
- if (Line.Pos("//")) BadLine = true;
- if (Line.Pos("MESSAGE_HANDLER")) BadLine = true;
- if (Line.Pos("BEGIN_MESSAGE_MAP")) BadLine = true;
- if (Line.Pos("END_MESSAGE_MAP")) BadLine = true;
-
- delete DefineLineSearch;
- return(BadLine);
- }
-
- void __fastcall TMainForm::ClassLBClick(TObject *Sender)
- {
- // Class listbox event
- ClassLBSel = ClassLB->Items->Strings[ClassLB->ItemIndex];
- ProcessSelectedClass();
- }
- //------------------------------------------------------------
-
- void __fastcall TMainForm::MemberName1Click(TObject *Sender)
- {
- bool SelectOK;
- String SearchMember;
-
- // Use VCL Table for sec indexes then refresh RawVCLTable
- SelectOK = InputQuery("SEARCH ENGINE", "Enter Member Name",
- SearchMember);
- if (SelectOK) {
- Screen->Cursor = crHourGlass;
- VCLTable->IndexName = "MemberNameIndex";
- VCLTable->SetRange(OPENARRAY(TVarRec, (SearchMember)),
- OPENARRAY(TVarRec, (SearchMember)));
- MainDS->DataSet = VCLTable;
- MemberSearch = true;
- if (!VCLTable->RecordCount) {
- ShowMessage(SearchMember +
- " is not a VCL Class member !");
- VCLTable->IndexName = "";
- MainDS->DataSet = RawVCLTable;
- Grid->DataSource = MainDS;
- MemberSearch = false;
- }
- Screen->Cursor = crDefault;
- }
- MainPgCtl->ActivePage = MainPgCtl->Pages[3];
- }
- //------------------------------------------------------------
-
- void __fastcall TMainForm::ShowRecordClick(TObject *Sender)
- {
- if (MemberSearch) {
- ClassLBSel = VCLTable->FieldByName("ClassName")->
- AsString;
- MemberSearch = false;
- }
- else
- ClassLBSel = RawVCLTable->FieldByName("ClassName")->
- AsString;
- ProcessSelectedClass();
- }
- //------------------------------------------------------------
-
- void __fastcall TMainForm::About1Click(TObject *Sender)
- {
- AboutBox = new TAboutBox(this);
- AboutBox->ShowModal();
- delete AboutBox;
- }
- //------------------------------------------------------------
-
- void __fastcall TMainForm::ClassName1Click(TObject *Sender)
- {
- // Search for class by Name
- String SearchClass;
- bool SelectOK;
- TLocateOptions tlo;
- String S1 = " class not found!";
- String S2 = " Check case sensitivity or verify";
- String S3 = " possible TypeDef";
- String String4 = S1 + S2 + S3;
- SelectOK = InputQuery("SEARCH ENGINE", "Enter Class Name",
- SearchClass);
- if (!SelectOK) return;
- if (SelectOK) {
- LocateSuccess = ClassListTab->Locate("ClassName",
- SearchClass, tlo);
- if (!LocateSuccess) {
- ShowMessage(SearchClass + String4);
- return;
- }
- ClassLBSel = SearchClass;
- ProcessSelectedClass();
- }
-
- }
- //------------------------------------------------------------
-
- void __fastcall TMainForm::ViewHeaderClick(TObject *Sender)
- {
- int LineFound;
- int LinePositionOne;
- int LineFound2;
- int LinePositionOne2;
-
- // View header file and highlight member name
- Show();
- LineFound2 = pasFileRE->Perform(EM_LINEFROMCHAR,
- pasFileRE->SelStart, 0);
- if (LineFound2 && (pasFileRE->Lines->Count > 10)) {
- LinePositionOne2 = pasFileRE->Perform(EM_LINEINDEX,
- LineFound2, 0);
- pasFileRE->Perform(EM_SETSEL, LinePositionOne2,
- LinePositionOne2 + pasFileRE->
- Lines->Strings[LineFound2].Length());
- }
- Application->ProcessMessages();
- LineFound = hppFileRE->Perform(EM_LINEFROMCHAR,
- hppFileRE->SelStart, 0);
- if (LineFound) {
- LinePositionOne = hppFileRE->Perform(EM_LINEINDEX,
- LineFound, 0);
- hppFileRE->Perform(EM_SETSEL, LinePositionOne,
- LinePositionOne + hppFileRE->
- Lines->Strings[LineFound].Length());
- }
- }
- //------------------------------------------------------------
-
- void __fastcall TMainForm::ViewSourceClick(TObject *Sender)
- {
- int LineFound;
- int LinePositionOne;
- int LineFound2;
- int LinePositionOne2;
-
- // View source file and highlight member name
- Show();
- LineFound2 = hppFileRE->Perform(EM_LINEFROMCHAR,
- hppFileRE->SelStart, 0);
- if (LineFound2) {
- LinePositionOne2 = hppFileRE->Perform(EM_LINEINDEX,
- LineFound2, 0);
- hppFileRE->Perform(EM_SETSEL, LinePositionOne2,
- LinePositionOne2 + hppFileRE->
- Lines->Strings[LineFound2].Length());
- }
- Application->ProcessMessages();
- LineFound = pasFileRE->Perform(EM_LINEFROMCHAR,
- pasFileRE->SelStart, 0);
-
- if (LineFound && (pasFileRE->Lines->Count > 10)) {
- LinePositionOne = pasFileRE->Perform(EM_LINEINDEX,
- LineFound, 0);
- pasFileRE->Perform(EM_SETSEL, LinePositionOne,
- LinePositionOne + pasFileRE->
- Lines->Strings[LineFound].Length());
- }
- }
- //------------------------------------------------------------
- void TMainForm::LoadDeclCode(const String LBString)
- {
- int LineCount;
- int Len;
- int d;
- int LLen;
- int x;
- int OccurNum = 1;
- int BeginNote;
- int EndNote;
- int ClassPos;
- String CodeLine;
- String OneChar;
- String HMemberCondense;
- String CondensedString;
- bool Match = false;
- bool FirstChar = false;
- bool AnEqual;
- bool AnEnd;
- bool OpenCurley;
- bool CloseCurley;
- bool SemiColon;
- bool b;
- bool c;
- long Temp;
- TStringList *DeclareSList = new TStringList();
- TSearchEngine *MDeclareSearch = new TSearchEngine();
- DeclareSList->Clear();
-
- // Strip and condense for .hpp declaration
- LLen = LBString.Length();
- for(x = 1; x <= LLen; x++) {
- OneChar = LBString.SubString(x, 1);
- if ((OneChar != " ") && (OneChar != "\t"))
- CondensedString = CondensedString + OneChar;
- }
-
- // Search for MemberName only for PasFile only
- while (!Match) {
- MDeclareSearch->SearchForString(MemberNameSel, OccurNum,
- 0, "Include");
- if (MDeclareSearch->PosFound == -1) {
- DeclareRE->Clear();
- DeclareRE->Lines->Add("Declaration not found!");
- return;
- }
- AnEqual = false;
- AnEnd = false;
- OpenCurley = false;
- CloseCurley = false;
- SemiColon = false;
- LineCount = 0;
- HMemberCondense = "";
- Temp = MDeclareSearch->LineNumFound;
-
- // Append multiple line functions
- while (!AnEnd) {
- d = 1;
- CodeLine = "";
- Len = hppFileRE->Lines->
- Strings[Temp + LineCount].Length();
- while ((d != Len + 1) && (!AnEnd)) {
- OneChar = hppFileRE->Lines->
- Strings[Temp + LineCount].SubString(d, 1);
- // handle note that has class in it
- BeginNote = hppFileRE->Lines->
- Strings[Temp + LineCount].Pos("/*");
- EndNote = hppFileRE->Lines->
- Strings[Temp + LineCount].Pos("*/");
-
- ClassPos = hppFileRE->Lines->
- Strings[Temp + LineCount].Pos("class");
- if (ClassPos)
- AnEnd = !((ClassPos > BeginNote) && (ClassPos < EndNote));
-
-
- b = OneChar == "}";
- c = OneChar == ";";
- if (OneChar == "{") OpenCurley = true;
- if (OneChar == "=") AnEqual = true;
- if (b) CloseCurley = true;
- if (c) SemiColon=true;
- if ((c) && (CloseCurley) && (OpenCurley))
- AnEnd = true;
- if ((c) && (!OpenCurley) && (!AnEqual))
- AnEnd = true;
- if ((c) && (!OpenCurley) && (!CloseCurley))
- AnEnd = true;
- if ((b) && (SemiColon) && (OpenCurley))
- AnEnd = true;
- if ((b) && (!SemiColon) && (OpenCurley) &&
- (!AnEqual)) AnEnd = true;
-
- // Once we found a source match ,condense it
- if ((OneChar != " ") && (OneChar != "\t")) {
-
- FirstChar = true;
- HMemberCondense = HMemberCondense + OneChar;
- }
- if (FirstChar) CodeLine = CodeLine + OneChar;
- d++;
- }
- DeclareSList->Add(CodeLine);
- FirstChar = false;
- LineCount++;
- }
- if (HMemberCondense.Pos(CondensedString))
- Match = true;
- else {
- OccurNum++;
- DeclareSList->Clear();
- }
- }
- DeclareRE->Lines->Clear();
- DeclareRE->Lines->AddStrings(DeclareSList);
- MainPgCtl->ActivePage = MainPgCtl->Pages[2];
- DeclareRE->SetFocus();
- DeclareRE->Perform(EM_SETSEL, 0, 0);
- delete DeclareSList;
- delete MDeclareSearch;
- }
-
- void TMainForm::LoadPasCode(const String MemberType,
- const String LBSelectMember)
- {
- int n = 1;
- int k = 1;
- int Len;
- int EndPos;
- int BeginPos;
- int TryPos;
- bool FirstBegin = false;
- bool ExtractDone = false;;
- bool CppFile = false;
- String CheckLine;
- TSearchEngine* SearchForDef = new TSearchEngine();
- TStringList* SStringList = new TStringList();
-
- // Pascal constructor uses create
- DefLength = (CurrentTab + "."+ MemberNameSel).Length();
- if (MemberType == "constructor") {
- MemberNameSel = "Create";
- CurrentTab = "constructor " + CurrentTab;
- }
-
-
- SearchForDef->SearchForString(CurrentTab + "." +
- MemberNameSel + "(", 1, 0, "Source");
-
- if (SearchForDef->PosFound == -1) {
- SearchForDef->SearchForString(CurrentTab + "." +
- MemberNameSel + ";", 1, 0, "Source");
- if (SearchForDef->PosFound == -1) {
- SearchForDef->SearchForString(CurrentTab + "." +
- MemberNameSel + ":", 1 , 0, "Source");
- if (SearchForDef->PosFound == -1) {
- SearchForDef->SearchForString(CurrentTab +
- "::" + MemberNameSel, 1, 0, "Source");
- if (SearchForDef->PosFound != -1)
- CppFile = true;
- else {
- DefineRE->Lines->Clear();
- SStringList->Clear();
- DefineRE->Lines->Strings[0] =
- "No function or procedure source available!";
- }
- }
- }
- }
-
- // For pascal file find begin and end
- if ((SearchForDef->PosFound != -1) && (!CppFile)) {
- DefineRE->Lines->Clear();
- SStringList->Add(pasFileRE->Lines->
- Strings[SearchForDef->LineNumFound]);
- while (!ExtractDone) {
- CheckLine = pasFileRE->Lines->
- Strings[SearchForDef->LineNumFound + n];
- Len = CheckLine.Length();
- BeginPos = CheckLine.Pos("begin");
- if ((BeginPos == 1) && (BeginPos == Len-4)) {
- if (!FirstBegin) k=0;
- FirstBegin = true;
- k++;
- }
- BeginPos = CheckLine.Pos(" begin");
- if ((BeginPos) && (BeginPos == Len - 5)) {
- if (!FirstBegin) k = 0;
- FirstBegin = true;
- k++;
- }
- TryPos = CheckLine.Pos("try");
- if ((TryPos == 1) && ((TryPos == Len - 4) ||
- (TryPos == Len - 3))) k++;
- TryPos = CheckLine.Pos(" try");
- if ((TryPos) && ((TryPos == Len - 4) ||
- (TryPos == Len - 3))) k++;
- EndPos = CheckLine.Pos("end else");
- if ((EndPos == 1) && ((EndPos == Len - 9) ||
- (EndPos == Len - 8)))k--;
- else
- EndPos = CheckLine.Pos("end");
- if ((EndPos == 1) && ((EndPos == Len-4) ||
- (EndPos == Len-3))) k--;
-
- EndPos = CheckLine.Pos(" end else");
- if ((EndPos) && ((EndPos == Len - 9) ||
- (EndPos == Len - 8))) k--;
- else
- EndPos = CheckLine.Pos(" end");
- if ((EndPos) && ((EndPos == Len-4) ||
- (EndPos == Len-3))) k--;
- if (!ExtractDone) SStringList->Add(CheckLine);
- if (!k) ExtractDone=true;
- n++;
- }
- DefineRE->Lines->AddStrings(SStringList);
- }
- delete SearchForDef;
- delete SStringList;
- }
- //------------------------------------------------------------
-
- void __fastcall TMainForm::ParseHeaderClick(TObject *Sender)
- {
- // For parsing 1 header at a time
- String OneChar;
- String Line;
- int CharCount;
- bool GotPasName;
-
- // Get File Name
- FileOpenDlg->InitialDir = LocalVclHeaders;
- FileOpenDlg->Options << ofHideReadOnly;
- FileOpenDlg->Filter = "*.hpp,*.h|*.hpp;*.h";
-
- if (FileOpenDlg->Execute()) {
- String temp = ExtractFileDir(FileOpenDlg->FileName) + "\\";
- if (temp.LowerCase() != LocalVclHeaders.LowerCase()) {
- ShowMessage("Sorry, VCL headers only!");
- return;
- }
- TabRebuildStats = new TTabRebuildStats(this);
- TabRebuildStats->HeaderBar->Show();
- TabRebuildStats->TotalBar->Hide();
- TabRebuildStats->TotalLab->Hide();
- TabRebuildStats->ParseLabel->Hide();
- TabRebuildStats->HeaderLab->Hide();
- TabRebuildStats->Caption = ("Parsing Header "+
- ExtractFileName(FileOpenDlg->FileName));
- TabRebuildStats->Show();
- Application->ProcessMessages();
- Enabled = false;
- TSearchEngine* PasFileSearch = new TSearchEngine();
- MembPgCtl->MultiLine = false;
- CharCount = 0;
- GotPasName = false;
- PasFileName = "";
- OneChar = "";
-
- // reset controls
- ClassLB->Items->Clear();
- MembersLV->Items->Clear();
- Application->ProcessMessages();
- ClearTabs();
-
- // Change vcltable to point to dest table
- VCLTable->Close();
- VCLTable->TableName = DestTable->TableName;
- VCLTable->Open();
-
- Screen->Cursor = crHourGlass;
- CurrentHeader = ExtractFileName(FileOpenDlg->FileName);
- hppFileRE->Clear();
- try {
- hppFileRE->Lines->
- LoadFromFile(FileOpenDlg->FileName);
- HeaderTab->Caption = CurrentHeader;
- TabRebuildStats->HeaderBar->Max = static_cast<Word>
- (hppFileRE->Lines->Count);
- }
- catch(EFOpenError& E) {
- ShowMessage(E.Message);
- Screen->Cursor = crDefault;
- }
-
- // Search header for ->pas filename
- pasFileRE->Clear();
- PasFileSearch->SearchForString(".pas", 1, 0, "Include");
- if (PasFileSearch->PosFound != -1) {
- Line = hppFileRE->Lines->
- Strings[PasFileSearch->LineNumFound];
- while (!GotPasName) {
- OneChar = Line.SubString(PasFileSearch->
- PosFound - PasFileSearch->
- LinePosOne - CharCount, 1);
- if ((OneChar == " ") || (OneChar == "/"))
- GotPasName=true;
- if (!GotPasName) {
- AppendStr(OneChar, PasFileName);
- PasFileName = OneChar;
- CharCount++;
- }
- }
- AppendStr(PasFileName,".pas");
- }
-
- // Empty table
- DestTable->Close();
- DestTable->TableName = "main2.db";
- DestTable->Open();
- DestTable->Close();
- DestTable->EmptyTable();
- DestTable->Open();
-
- // Parse and load
- RawVCLTable->Free();
- RawVCLTable = new TCloneTable(DestTable, True);
- RawVCLTable->Open();
- MainDS->DataSet = RawVCLTable;
- Grid->Refresh();
- RawVCLTable->First();
- HppToDestTable();
-
- // Clean up
- Screen->Cursor = crDefault;
- ViewParent->Enabled = false;
- MemberName1->Enabled = false;
- ClassName1->Enabled = false;
- TabRebuildStats->Hide();
- Enabled = true;
- int TotalPages = MembPgCtl->PageCount;
- for (int pg = 0; pg < TotalPages; pg++) {
- ClassLB->Items->Add(MembPgCtl->Pages[pg]->
- Caption);
- }
- delete PasFileSearch;
- delete TabRebuildStats;
- MainPgCtl->ActivePage = MainPgCtl->Pages[1];
- MembersLV->Parent = MembPgCtl->ActivePage;
- MembersLV->Align = alClient;
- }
- }
-
- //------------------------------------------------------------
- void __fastcall TMainForm::LoadVCLTableClick(TObject *Sender)
- {
- // Reload the vcl table
- VCLTable->Close();
- VCLTable->TableName = "vcltable.db";
- VCLTable->Open();
-
- RawVCLTable->Free();
- RawVCLTable = new TCloneTable(VCLTable, True);
- RawVCLTable->Open();
- MainDS->DataSet = RawVCLTable;
- Grid->Refresh();
- RawVCLTable->First();
-
- ViewParent->Enabled = true;
- MemberName1->Enabled = true;
- ClassName1->Enabled = true;
- ClearTabs();
- MembPgCtl->MultiLine = true;
- LoadClasses();
- MainPgCtl->ActivePage = MainPgCtl->Pages[0];
- }
- //-------------------------------------------------------------
-
- void __fastcall TMainForm::ClosePageClick(TObject *Sender)
- {
- if (MembPgCtl->PageCount > 1) {
- int ActPage;
- ActPage = MembPgCtl->ActivePage->PageIndex;
- MembersLV->Parent = MembPgCtl->Pages[ActPage - 1];
- MembersLV->Items->Clear();
- MembPgCtl->ActivePage->Free();
- MembPgCtl->ActivePage = MembPgCtl->Pages[ActPage - 1];
- SelectATab(Sender);
- }
- }
- //------------------------------------------------------------
-
- void __fastcall TMainForm::CloseAllClick(TObject *Sender)
- {
- ClearTabs();
- SelectATab(Sender);
- }
- //------------------------------------------------------------
-
- void TMainForm::ClearTabs()
- {
- // Clear all tabs
- if (MembPgCtl->PageCount > 0) {
- MembPgCtl->ActivePage = MembPgCtl->Pages[MembPgCtl->PageCount - 1];
- MembersLV->Parent = MembPgCtl->ActivePage;
- int ActPage;
- ActPage = MembPgCtl->ActivePage->PageIndex;
- DeleteTabs = true;
-
- while (MembPgCtl->ActivePage != NULL) {
- if (MembPgCtl->PageCount == 1) break;
- MembersLV->Parent = MembPgCtl->Pages[ActPage - 1];
- MembersLV->Items->Clear();
- MembPgCtl->ActivePage->Free();
- MembPgCtl->ActivePage = MembPgCtl->Pages[ActPage - 1];
- Application->ProcessMessages();
- ActPage = ActPage - 1;
- }
- DeleteTabs = false;
- }
- }
-
- void TMainForm::LoadSourcePage()
- {
- // Dump the .pas/.cpp into the richedit
- pasFileRE->Clear();
- SourceTab->Caption = "N/A";
- DoesFileExist = FileExists(LocalVclSource + "vcl\\" +
- CurrentSource);
- if (DoesFileExist) {
- pasFileRE->Lines->LoadFromFile(LocalVclSource
- + "vcl\\" + CurrentSource);
- SourceTab->Caption = CurrentSource;
- }
- else {
- DoesFileExist = FileExists(LocalVclSource +
- "toolsapi\\" + CurrentSource);
- if (DoesFileExist) {
- pasFileRE->Lines->
- LoadFromFile(LocalVclSource +
- "toolsapi\\" + CurrentSource);
- SourceTab->Caption = CurrentSource;
- }
- else
- pasFileRE->Lines->Strings[0] =
- "Source Not Available for this Class!";
- }
- if(CurrentHeader.LowerCase() == "dstring.h") {
- DoesFileExist = FileExists(LocalVclSource +
- "vcl\\" + "dstring.cpp");
- if (DoesFileExist) {
- pasFileRE->Lines->
- LoadFromFile(LocalVclSource +
- "vcl\\" + "dstring.cpp");
- SourceTab->Caption = "dstring.cpp";
- }
- }
- if(CurrentHeader.LowerCase() == "wstring.h") {
- DoesFileExist = FileExists(LocalVclSource +
- "vcl\\" + "wstring.cpp");
- if (DoesFileExist) {
- pasFileRE->Lines->
- LoadFromFile(LocalVclSource +
- "vcl\\" + "wstring.cpp");
- SourceTab->Caption = "wstring.cpp";
- }
- }
- if(CurrentHeader.LowerCase() == "sysdefs.h") {
- DoesFileExist = FileExists(LocalVclSource +
- "vcl\\" + "Variant.cpp");
- if (DoesFileExist) {
- pasFileRE->Lines->
- LoadFromFile(LocalVclSource +
- "vcl\\" + "Variant.cpp");
- SourceTab->Caption = "Variant.cpp";
- }
- }
- }
-
- void __fastcall TMainForm::ChangeFonts(TObject *Sender)
- {
- String String1;
- String String2;
- String1 = "\\software\\borland\\VCL Object Browser\\fonts";
- String2 = "\\software\\borland\\VCL Object Browser\\fonts\\size";
- int MyFontInteger;
- if (FontDialog1->Execute()) {
- if (Sender == SourcePage) pasFileRE->
- Font = FontDialog1->Font;
- if (Sender == HeaderPage) hppFileRE->
- Font = FontDialog1->Font;
- if (Sender == Declaration) DeclareRE->
- Font = FontDialog1->Font;
- if (Sender == Definition) DefineRE->
- Font = FontDialog1->Font;
- if (Sender == QuickClass) ClassLB->
- Font = FontDialog1->Font;
- if (Sender == MemberList) MembersLV->
- Font = FontDialog1->Font;
- if (Sender == Grid1) {
- Grid->Columns->Items[1]->Font = FontDialog1->Font;
- Grid->Columns->Items[2]->Font = FontDialog1->Font;
- Grid->Columns->Items[3]->Font = FontDialog1->Font;
- Grid->Columns->Items[4]->Font = FontDialog1->Font;
- }
-
- MyFontInteger = FontDialog1->Font->Color;
- int MyFontSize = FontDialog1->Font->Size;
- TRegistry *MyRegistry = new TRegistry();
- try {
- MyRegistry->RootKey = HKEY_LOCAL_MACHINE;
- assert(MyRegistry->OpenKey(String1, false));
- if (Sender == SourcePage) MyRegistry->WriteString(
- "DefinitionPage", IntToStr(MyFontInteger));
- if (Sender == HeaderPage) MyRegistry->WriteString(
- "HeaderPage", IntToStr(MyFontInteger));
- if (Sender == Declaration) MyRegistry->WriteString(
- "Declaration", IntToStr(MyFontInteger));
- if (Sender == Definition) MyRegistry->WriteString(
- "Definition", IntToStr(MyFontInteger));
- if (Sender == QuickClass) MyRegistry->WriteString(
- "QuickClass", IntToStr(MyFontInteger));
- if (Sender == MemberList) MyRegistry->WriteString(
- "MemberList", IntToStr(MyFontInteger));
- if (Sender == Grid1) MyRegistry->WriteString(
- "Grid", IntToStr(MyFontInteger));
- }
- catch(ERegistryException &E) {
- ShowMessage(E.Message);
- delete MyRegistry;
- return;
- }
-
- try {
- MyRegistry->RootKey = HKEY_LOCAL_MACHINE;
- assert(MyRegistry->OpenKey(String2, false));
- if (Sender == SourcePage) MyRegistry->WriteString(
- "DefinitionPage", IntToStr(MyFontSize));
- if (Sender == HeaderPage) MyRegistry->WriteString(
- "HeaderPage", IntToStr(MyFontSize));
- if (Sender == Declaration) MyRegistry->WriteString(
- "Declaration", IntToStr(MyFontSize));
- if (Sender == Definition) MyRegistry->WriteString(
- "Definition", IntToStr(MyFontSize));
- if (Sender == QuickClass) MyRegistry->WriteString(
- "QuickClass", IntToStr(MyFontSize));
- if (Sender == MemberList) MyRegistry->WriteString(
- "MemberList", IntToStr(MyFontSize));
- if (Sender == Grid1) MyRegistry->WriteString(
- "Grid", IntToStr(MyFontSize));
- }
- catch(ERegistryException &E) {
- ShowMessage(E.Message);
- delete MyRegistry;
- return;
- }
- delete MyRegistry;
- TFontStyles FStyle;
- // FStyle << fsBold;
- ClassLB->Font->Style = FStyle;
- }
- }
-
- //------------------------------------------------------------
- void __fastcall TMainForm::ChangeBkgnds(TObject *Sender)
- {
- String String1 = "\\software\\borland\\VCL Object Browser\\colors";
- if (ColorDialog1->Execute()) {
- if (Sender == SourcePage2) pasFileRE->
- Color = ColorDialog1->Color;
- if (Sender == HeaderPage2) hppFileRE->
- Color = ColorDialog1->Color;
- if (Sender == Declaration2) DeclareRE->
- Color = ColorDialog1->Color;
- if (Sender == Definition2) DefineRE->
- Color = ColorDialog1->Color;
- if (Sender == QuickClass2) ClassLB->
- Color = ColorDialog1->Color;
- if (Sender == MemberList2) MembersLV->
- Color = ColorDialog1->Color;
- if (Sender == Grid2) Grid->
- Color = ColorDialog1->Color;
- TRegistry *MyRegistry = new TRegistry();
- try {
- MyRegistry->RootKey = HKEY_LOCAL_MACHINE;
- assert(MyRegistry->OpenKey(String1, false));
- if (Sender == SourcePage2) MyRegistry->WriteString(
- "DefinitionPage",
- IntToStr(ColorDialog1->Color));
- if (Sender == HeaderPage2) MyRegistry->WriteString(
- "HeaderPage",
- IntToStr(ColorDialog1->Color));
- if (Sender == Declaration2) MyRegistry->WriteString(
- "Declaration",
- IntToStr(ColorDialog1->Color));
- if (Sender == Definition2) MyRegistry->WriteString(
- "Definition",
- IntToStr(ColorDialog1->Color));
- if (Sender == QuickClass2) MyRegistry->WriteString(
- "QuickClass",
- IntToStr(ColorDialog1->Color));
- if (Sender == MemberList2) MyRegistry->WriteString(
- "MemberList",
- IntToStr(ColorDialog1->Color));
-
- if (Sender == Grid2)MyRegistry->WriteString("Grid",
- IntToStr(ColorDialog1->Color));
- }
- catch(ERegistryException &E) {
- ShowMessage(E.Message);
- delete MyRegistry;
- return;
- }
- delete MyRegistry;
- }
- }
- //------------------------------------------------------------
-
- int TMainForm::FindImageIndex(const String Scope,
- const String Member)
- {
- bool a = Scope == "public";
- bool b = Scope == "__published";
- bool c = Scope == "protected";
- bool d = Scope == "private";
-
- bool h = Member == "function";
- bool i = Member == "data";
- bool j = Member == "constructor";
- bool k = Member == "property";
-
- if ((c) && (h)) return(0);
- if ((c) && (i)) return(1);
- if ((c) && (j)) return(2);
- if ((c) && (k)) return(3);
- if ((b) && (h)) return(4);
- if ((b) && (i)) return(5);
- if ((b) && (j)) return(6);
- if ((b) && (k)) return(7);
- if ((d) && (h)) return(8);
- if ((d) && (i)) return(9);
- if ((d) && (j)) return(10);
- if ((d) && (k)) return(11);
- if ((a) && (h)) return(12);
- if ((a) && (i)) return(13);
- if ((a) && (j)) return(14);
- if ((a) && (k)) return(15);
- return(0);
- }
-
- void __fastcall TMainForm::ViewParentClick(TObject *Sender)
- {
- ClassLBSel = RawVCLTable->FieldByName("SecondClass")->AsString;
- if ((ClassLBSel != "")) {
- Grid->DataSource = MainDS;
- RawVCLTable->Refresh();
- Screen->Cursor = crHourGlass;
- RawVCLTable->DisableControls();
- RawVCLTable->Filtered = false;
- RawVCLTable->SetRange(OPENARRAY(TVarRec, (ClassLBSel)),
- OPENARRAY(TVarRec, (ClassLBSel)));
- CurrentHeader = RawVCLTable->FieldByName("Header")->AsString;
- CurrentSource = RawVCLTable->FieldByName("Misc")->AsString;
- TTabSheet *NewTabSheet = new TTabSheet(this);
- NewTabSheet->Caption = ClassLBSel;
- NewTabSheet->PageControl = MembPgCtl;
- MembersLV->Parent = NewTabSheet;
- MembersLV->Align = alClient;
- MembPgCtl->ActivePage = MembPgCtl->Pages
- [MembPgCtl->PageCount - 1];
- TableToListStrings(ClassLBSel);
- hppFileRE->Clear();
- try {
- hppFileRE->Lines->LoadFromFile(
- LocalVclHeaders + CurrentHeader);
- HeaderTab->Caption = CurrentHeader;
- }
- catch(EFOpenError& E) {
- ShowMessage(E.Message);
- Screen->Cursor = crDefault;
- return;
- }
- LoadSourcePage();
- RawVCLTable->First();
- RawVCLTable->EnableControls();
- Screen->Cursor = crDefault;
- }
- else
- ShowMessage("No class derivation info available!");
- }
- //------------------------------------------------------------
-
- void TMainForm::ProcessSelectedClass()
- {
- MainPgCtl->ActivePage = MainPgCtl->Pages[1];
- MemberNameSel = "";
- DefLength = 0;
- VCLTable->IndexName = "";
- MainDS->DataSet = RawVCLTable;
- Screen->Cursor = crHourGlass;
- RawVCLTable->DisableControls();
- RawVCLTable->Filtered = false;
- RawVCLTable->SetRange(OPENARRAY(TVarRec, (ClassLBSel)),
- OPENARRAY(TVarRec, (ClassLBSel)));
- RawVCLTable->First();
- CurrentHeader = RawVCLTable->FieldByName("Header")->AsString;
- CurrentSource = RawVCLTable->FieldByName("Misc")->AsString;
- TTabSheet *NewTabSheet = new TTabSheet(this);
- NewTabSheet->Caption = ClassLBSel;
- NewTabSheet->PageControl = MembPgCtl;
- MembersLV->Parent = NewTabSheet;
- MembersLV->Align = alClient;
- MembPgCtl->ActivePage = MembPgCtl->Pages
- [MembPgCtl->PageCount - 1];
- MembersLV->ViewStyle = vsList;
- Application->ProcessMessages();
- TableToListStrings(ClassLBSel);
- RawVCLTable->First();
- pasFileRE->Clear();
- LoadSourcePage();
- try {
- hppFileRE->Lines->LoadFromFile(
- LocalVclHeaders + CurrentHeader);
- HeaderTab->Caption = CurrentHeader;
- }
- catch(EFOpenError& E) {
- ShowMessage(E.Message);
- Screen->Cursor = crDefault;
- return;
- }
- RawVCLTable->EnableControls();
- TObject *Sender = new TObject();
- delete Sender;
- Screen->Cursor = crDefault;
- }
-
- void __fastcall TMainForm::PublicLabClick(TObject *Sender)
- {
- String PublicStr = "[Scope]='public'";
- String PublishStr = "[Scope]='__published'";
- String ProtectStr = "[Scope]='protected'";
- String PrivateStr = "[Scope]='private'";
- String FilterStr = "";
-
- TToolButton *Tbtn = dynamic_cast<TToolButton *>(Sender);
- RawVCLTable->DisableControls();
- RawVCLTable->Filtered = false;
- if(Tbtn->Tag) {
- Tbtn->Down = false;
- Tbtn->Tag = 0;
- }
- else {
- Tbtn->Down = true;
- Tbtn->Tag = 1;
- }
-
- if (PublicBtn->Down) FilterStr = FilterStr + PublicStr;
- if ((PublishBtn->Down) && (PublicBtn->Down)) FilterStr =
- FilterStr + " OR " + PublishStr;
- else if (PublishBtn->Down) FilterStr = FilterStr + PublishStr;
- if ((ProtectBtn->Down && (PublishBtn->Down || PublicBtn->Down))) FilterStr =
- FilterStr + " OR " + ProtectStr;
- else if (ProtectBtn->Down) FilterStr = FilterStr + ProtectStr;
- if ((PrivateBtn->Down && (PublicBtn->Down || PublishBtn->Down ||
- ProtectBtn->Down))) FilterStr = FilterStr + " OR " + PrivateStr;
- else if (PrivateBtn->Down) FilterStr = FilterStr + PrivateStr;
-
- RawVCLTable->Filter = FilterStr;
- RawVCLTable->Filtered = true;
- RawVCLTable->First();
- TableToListStrings(ClassLBSel);
- RawVCLTable->Filtered = false;
- RawVCLTable->EnableControls();
- }
- //------------------------------------------------------------
-
- void __fastcall TMainForm::ExitClick(TObject *Sender)
- {
- Application->Terminate();
- }
- //------------------------------------------------------------
-
- void __fastcall TMainForm::MembersLVKeyDown(TObject *Sender, WORD &Key,
- TShiftState Shift)
- {
- if (Key == 13)MembersLVClick(Sender);
- }
-
- void __fastcall TMainForm::ViewMultipleClick(TObject *Sender)
- {
- // MembersLV->ViewStyle = vsList;
- //SelectATab(Sender);
- }
- //------------------------------------------------------------
-
- void __fastcall TMainForm::ViewExpandedClick(TObject *Sender)
- {
- //MembersLV->ViewStyle = vsReport;
- }
- //------------------------------------------------------------
-
- void __fastcall TMainForm::OpenhppcppClick(TObject *Sender)
- {
- // Get File Name
- FileOpenDlg->InitialDir = LocalVclHeaders;
- FileOpenDlg->Options << ofHideReadOnly;
- FileOpenDlg->Filter = "*.hpp,*.h,*.cpp,*.c|*.hpp;*.h;*.cpp;*.c";
- if (FileOpenDlg->Execute()) {
- hppFileRE->Lines->LoadFromFile(
- FileOpenDlg->FileName);
- pasFileRE->Clear();
- Show();
- }
- MainPgCtl->ActivePage = MainPgCtl->Pages[4];
- }
- //------------------------------------------------------------
-
- TExtractObjects::TExtractObjects()
- {
- }
-
- void TExtractObjects::ExtractNameAndType(int StartPosition,
- int EndPos, String LineString, String Phase)
- {
- int AProperty;
- int StartRetType;
- int FirstCharPos;
- int x;
- int j;
- String a;
- bool NoReturnType = false;
- ObjectName = "";
- ObjectType = "";
-
- x = EndPos;
- LastCommaPosition = EndPos;
- x = x - 1;
- a = LineString.SubString(x, 1);
-
- // Skip tabs and spaces
- while ((a == " ")|| (a == "\t")) {
- x--;
- a = LineString.SubString(x, 1);
- }
- while ((a != " ") && (a != "(") && (a != "\t")
- && (a != ",") && (a != "{")
- && (a != "*")) {
- a=LineString.SubString(x, 1);
- if (a == "{") NoReturnType = true;
- x--;
- }
- x = x + 2;
- FirstCharPos = x;
- a = LineString.SubString(x, 1);
- AProperty = LineString.Pos("__property");
-
- // Handle extracting property names differently
- if ((AProperty) && (Phase == "MemberName")) {
- while ((a != "=") && (a != "}") &&
- (a != ";")) {
- ObjectName = ObjectName+a;
- x++;
- a = LineString.SubString(x, 1);
- }
- }
- else {// extract object name
- while ((a != " ") && (a != "\t") &&
- (a != ";") && (a != ",")
- && (a != "(") && (a != ")")
- && (a != "{") && (a != "}")) {
- ObjectName = ObjectName + a;
- x++;
- a = LineString.SubString(x, 1);
- }
- }
-
- // extract return type
- if (FirstCharPos == 1) NoReturnType = true;
- FirstCharPos = FirstCharPos - 1;
- a = LineString.SubString(FirstCharPos, 1);
-
- // eliminate operator in return type
- int OperatorLine = LineString.Pos("operator");
- if ((OperatorLine) && (Phase=="MemberName")) {
- FirstCharPos = OperatorLine - 1;
- ObjectName = "operator " + ObjectName;
- }
-
- //backup until found last letter of Return Type
- while ((a==" ") && (!NoReturnType)) {
- if (FirstCharPos == 1) NoReturnType = true;
- FirstCharPos--;
- a = LineString.SubString(FirstCharPos, 1);
- }
-
- if (!NoReturnType) {
- StartRetType = StartPosition;
- a = LineString.SubString(StartRetType, 1);
- // find start pos of ReturnType
- while (a == " ") {
- StartRetType = StartRetType + 1;
- a = LineString.SubString(StartRetType, 1);
- }
- for (j = StartRetType; j <= FirstCharPos; j++) {
- a = LineString.SubString(j, 1);
- if (a != "\t") ObjectType = ObjectType + a;
- }
- }
- }
-
- TSearchEngine::TSearchEngine()
- {
- }
-
- void TSearchEngine::SearchForString(String Word, int Occurance,
- int StartPosition, String Page)
- {
- TFindText MyTFindText;
- int OccuranceCount;
- String SearchValue;
- OccuranceCount = 0;
- SearchValue = Word;
- NewSearchPos = 0;
- LineNumFound = 0;
- LinePosOne = 0;
- PosFound = 0;
-
- // Setup Find Text struct
- MyTFindText.chrg.cpMin = StartPosition;
- MyTFindText.chrg.cpMax = -1;
- MyTFindText.lpstrText = Word.c_str();
-
- // If none found stop at defined Occurance
- while ((PosFound != -1) && (OccuranceCount != Occurance)) {
- if (Page == "Include") PosFound =
- MainForm->hppFileRE->Perform(EM_FINDTEXT, FT_MATCHCASE,
- long(&MyTFindText));
- if (Page == "Source") PosFound =
- MainForm->pasFileRE->Perform(EM_FINDTEXT, FT_MATCHCASE,
- long(&MyTFindText));
- if ((PosFound != -1) && (OccuranceCount != Occurance)) {
- if (Page == "Include") {
- MainForm->hppFileRE->Perform(EM_SETSEL,
- PosFound, PosFound);
- LineNumFound = MainForm->hppFileRE->
- Perform(EM_LINEFROMCHAR,
- MainForm->hppFileRE->SelStart, 0);
- LinePosOne = MainForm->hppFileRE->
- Perform(EM_LINEINDEX, LineNumFound, 0);
- }
- if (Page == "Source") {
- MainForm->pasFileRE->Perform(EM_SETSEL,
- PosFound, PosFound);
- LineNumFound = MainForm->pasFileRE->Perform(
- EM_LINEFROMCHAR,
- MainForm->pasFileRE->SelStart, 0);
- LinePosOne = MainForm->pasFileRE->
- Perform(EM_LINEINDEX, LineNumFound, 0);
- }
- MyTFindText.chrg.cpMin = PosFound + 1;
- NewSearchPos = PosFound + 1;
- OccuranceCount++;
- }
- if (PosFound == -1) LineNumFound = 999999;
- }
- }
-
- void TMainForm::LoadCppDef(const String ParamArray[8],
- const int ParamQty)
- {
- String CodeLine;
- String OneChar;
- String CndseStr = "";
- String LBString;
- String CNString;
- String HMemCndns = "";
- String PString;
- String CndnsPType;
- bool Match = false;
- bool FirstChar = false;
- bool FoundCName = false;
- bool FoundPT = false;
- bool Break;
- bool OpenBrkt;
- int MyCount;
- int b;
- int StrLength;
- int OpenParen;
- int ClosedParen;
- int Diff;
- int Len;
- int x;
- int c;
- int CheckAnsiString;
- int CheckString;
- int OccurNum = 1;
- TStringList *DeclareSList = new TStringList();
- TSearchEngine *MDeclareSearch = new TSearchEngine();
-
- // strip spaces and tabs from selected item
- CNString = CurrentTab + "::" + MemberNameSel;
- Len = CNString.Length();
- for (x = 1; x <= Len; x++) {
- OneChar = CNString.SubString(x, 1);
- if ((OneChar != " ") && (OneChar != "\t")) CndseStr =
- CndseStr + OneChar;
- }
-
- // Search for member name
- while (!Match) {
- if (MemberNameSel.Pos("operator") > 0)
- MemberNameSel = "operator";
-
- // Its best to search for only the function name
- // because we would have to condense the whole .cpp file
- MDeclareSearch->SearchForString("::" + MemberNameSel,
- OccurNum, 0, "Source");
- if (MDeclareSearch->PosFound == -1) {
- DefineRE->Clear();
- DefineRE->Lines->Add("Definition not found!");
- return;
- }
-
- // piece together the complete function
- Break = false;
- OpenBrkt = false;
- MyCount = 0;
- b = 0;
- while (!Break) {
- x = 1;
- CodeLine = "";
- StrLength = pasFileRE->Lines->
- Strings[MDeclareSearch->LineNumFound + b].Length();
- while ((x != StrLength + 1) && (!Break)) {
- OneChar = pasFileRE->Lines->
- Strings[MDeclareSearch->
- LineNumFound + b].SubString(x, 1);
- if (OneChar == "{") {
- OpenBrkt = true;
- MyCount = MyCount + 1;
- }
- if (OneChar == "}") MyCount = MyCount - 1;
- if ((!MyCount) && (OpenBrkt)) Break = true;
- if ((OneChar != " ") && (OneChar != "\t")) {
- FirstChar = true;
- // Condense it
- HMemCndns = HMemCndns + OneChar;
- }
- if (FirstChar) CodeLine = CodeLine + OneChar;
- x++;
- }
- DeclareSList->Add(CodeLine);
- FirstChar = false;
- b++;
- }
-
- /* Once we have the complete function stripped and in a
- String, check params to see if correct definition */
- if (ParamQty == 0) {
- if (HMemCndns.Pos(CndseStr + "()"))
- FoundCName = true;
- FoundPT = true;
- }
- else {
- if (HMemCndns.Pos(CndseStr)) {
- // Lets get the pos of first of "(" and ")"
- OpenParen = HMemCndns.Pos("(");
- ClosedParen = HMemCndns.Pos(")");
- Diff = ClosedParen - OpenParen;
- PString = HMemCndns.SubString(OpenParen + 1,
- Diff - 1);
- FoundCName = true;
- for(c = 0; c < ParamQty; c++) {
- FoundPT = false;
- CndnsPType = "";
- // Strip and condense Param Type
- for(x = 1; x <= (ParamArray[c].Length()); x++) {
- OneChar = ParamArray[c].SubString(x, 1);
- if ((OneChar != " ") && (OneChar != "\t"))
- CndnsPType = CndnsPType + OneChar;
- }
- if (PString.Pos(CndnsPType))
- FoundPT = true;
- else {
- CheckAnsiString =
- CndnsPType.Pos("AnsiString");
- if (CheckAnsiString) {
- // delete "AnsiString"
- CndnsPType.Delete(CheckAnsiString,10);
- // insert "String"
- CndnsPType.Insert("String",
- CheckAnsiString);
- if (PString.Pos(CndnsPType))
- FoundPT = true;
- else {
- CheckString =
- CndnsPType.Pos("String");
- if (CheckString){
- // delete "String"
- CndnsPType.Delete(CheckString,
- 6);
- // insert "AnsiString"
- CndnsPType.Insert("AnsiString",
- CheckString);
- if (PString.Pos(CndnsPType))
- FoundPT = true;
- }
- }
- }
- }
- if (!FoundPT)break;
- }
- }
- }
- if ((FoundPT) && (FoundCName))
- Match = true;
- else {
- HMemCndns = "";
- OccurNum++;
- DeclareSList->Clear();
- }
- }
- DefineRE->Clear();
- DefineRE->Lines->AddStrings(DeclareSList);
- DefineRE->SetFocus();
- DefineRE->Perform(EM_SETSEL, 0, 0);
- delete DeclareSList;
- delete MDeclareSearch;
- } // one bug: constructors with 1 parameter char and char*
-
- void __fastcall TMainForm::MainPgCtlChange(TObject *Sender)
- {
- int PgIndex = MainPgCtl->ActivePage->PageIndex;
- if (PgIndex == 4) ViewHeaderClick(Sender);
- if (PgIndex == 5) ViewSourceClick(Sender);
- }
- //---------------------------------------------------------------------------
-
- void __fastcall TMainForm::RestrictSize(TMessage& Msg)
- {
- ((POINT far *)Msg.LParam)[3].x = 480;
- ((POINT far *)Msg.LParam)[3].y = 400;
- TForm::Dispatch(&Msg);
- }
-
- void __fastcall TMainForm::Print(TObject *Sender)
- {
- TMenuItem* Item;
- Item = dynamic_cast<TMenuItem *>(Sender);
-
- if (Item->Caption == "Print Header file")
- if(PrintDialog1->Execute())hppFileRE->Print(CurrentHeader);
- if (Item->Caption == "Print Source file")
- if(PrintDialog1->Execute())pasFileRE->Print(CurrentSource);
- if (Item->Caption == "Print Prototype")
- if(PrintDialog1->Execute()) DeclareRE->Print(MemberNameSel + " Prototype");
- if (Item->Caption == "Print Definition")
- if(PrintDialog1->Execute()) DefineRE->Print(MemberNameSel + " Definition");
-
- }
- //------------------------------------------------------------
-
-
- void __fastcall TMainForm::FindDlgFind(TObject *Sender)
- {
- int Page;
- Page = MainPgCtl->ActivePage->PageIndex;
- if (Page < 4) return;
- const String Search = FindDlg->FindText;
-
- // Setup search struct
- bool FoundOne;
- TFindText MyTFindText;
- MyTFindText.chrg.cpMin = PosFound;
- if (PosFound) MyTFindText.chrg.cpMin = PosFound + Search.Length();
- MyTFindText.chrg.cpMax = -1;
- MyTFindText.lpstrText = strdup(Search.c_str());
-
- //String temptab = MainPgCtl->ActivePage->Caption;
-
- TRichEdit *RE = (TRichEdit *) MainPgCtl->ActivePage->Controls[0];
- PosFound = RE->Perform(EM_FINDTEXT, FT_WHOLEWORD, (LPARAM) (&MyTFindText));
- FoundOne = PosFound != -1;
- RE->Perform(EM_SETSEL, PosFound, PosFound + Search.Length());
- RE->Perform(EM_SCROLLCARET, 0, 0);
- RE->SetFocus();
-
- if (!FoundOne) {
- ShowMessage("End of Page! \"" + Search + "\" not found!");
- return;
- }
- }
- //---------------------------------------------------------------------------
-
- void __fastcall TMainForm::Find1Click(TObject *Sender)
- {
- if (FindDlg->Execute()) {
- PosFound = 0;
- FindNext1->Enabled = true;
- }
- }
- //---------------------------------------------------------------------------
-
- void __fastcall TMainForm::ClassLBKeyDown(TObject *Sender, WORD &Key,
- TShiftState Shift)
- {
- if (Key == 13)ClassLBClick(Sender);
- }
- //---------------------------------------------------------------------------
-
- void __fastcall TMainForm::FormClose(TObject *Sender, TCloseAction &Action)
- {
- Action = caFree;
- MainForm = NULL;
- ClassOrgDB->Connected = false;
- }
- //------------------------------------------------------------
-